package sqlite;

import sqlite.utils.DBPool;
import sqlite.utils.DBUtils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * Created by GanJc on 2015/12/7.
 */
public class CreateDB {


    public static void main(String[] args) throws SQLException {
        Connection connection = null;
        try {
            connection = DBPool.getInstance().getConnection("jdbc:sqlite:test2.db","","");
            System.out.println("Opened database successfully");
        } catch (Exception e) {
            System.err.println(e.getClass().getName() + ": " + e.getMessage());
            System.exit(0);
        }
        String createDb = "create table if not exists student ( \n" +
                " id integer primary key, \n" +
                " name varchar(10), \n" +
                " age integer\n" +
                "); " ;
        DBUtils.execute(connection,createDb,null);

    }

}
